home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / iqb9203.zip / QUALNAME.BAS < prev    next >
BASIC Source File  |  1992-02-06  |  1KB  |  31 lines

  1. ' QualName.Bas - Support module to contain the QualifyName$ function.
  2.  
  3. ' $INCLUDE: 'QUALNAME.BI'
  4. ' $INCLUDE: 'QB.BI'
  5.  
  6. FUNCTION QualifyName$ (InSpec$)
  7. ' QualifyName$() - This function takes an incomplete file spec
  8. '                  and returns a fully-qualified pathname.
  9. '                  If the name cannot be qualified, the
  10. '                  original input string is returned instead.
  11. DIM Regs AS RegType
  12. DIM InPath AS STRING * 128
  13. DIM OutPath AS STRING * 128
  14.  
  15. LSET InPath = ""
  16. LSET OutPath = ""
  17. InPath = InSpec$ + CHR$(0)  ' make an ASCIIZ version of input spec
  18. Regs.AX = &H6000            ' invoke the TRUENAME DOS function
  19. Regs.SI = VARPTR(InPath)
  20. Regs.DI = VARPTR(OutPath)
  21. Interrupt &H21, Regs, Regs
  22. ' Check to see if the operation succeded.
  23. IF Regs.Flags AND 1 THEN
  24.   ' Carry set... there was a problem with the name. Just 
  25.   ' return the original specification.
  26.   QualifyName$ = InSpec$
  27. ELSE
  28.   QualifyName$ = MID$(OutPath, 1, INSTR(OutPath, CHR$(0)) - 1)
  29. END IF
  30. END FUNCTION
  31.